import Vue from 'vue'

export default {
  name: 'order',
  data() {
    return {
      Flag: "",
      orderId:"",
      menu: [{ id: "1", name: "全部订单" }, { id: "2", name: "待支付" }, { id: "3", name: "已完成" }],
    }
  },
  components: {
  },
  methods: {
    getOrder() {
      this.axios.get('/order/list', {
        params: {
          openid: this.openid,
          status: this.orderId,
          offset:0,
          limit:5
        }
      }).then(res => {
        console.log(res)
      }, err => {
        console.log(err)
      })
    },
    goOrderDetail(id) {
      this.$router.push({ path: "/OrderDetail", query: { id: id } })
    },
    changeOrder(i) {
      this.Flag = i;
      if(i==0){
        this.orderId=""
      }else{
        this.orderId=i-1;
      }
      this.getOrder();
    },
    goFeedback() {
      this.$router.push({ path: "/feedback" })
    },
    goPay(){
      this.$router.push({ path: "/settlement",query:{id:1} })
    }
  },
  mounted() {
   
  },
  created() {
    if(this.$route.query.id!=undefined){
      this.Flag = this.$route.query.id+1;
      this.orderId=this.$route.query.id
    }else{
      this.Flag=0;
    }
    this.openid = sessionStorage.getItem("openId")
    this.getOrder();
  },
}